import Vue from "vue";
import Vuex from "vuex";
import getters from "@/store/getters";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    currentIcmpIndex: 0,
    currentIcmpPacket: {},
    currentUdpIndex: 0,
    currentUdpPacket: {},
    currentArpIndex: 0,
    currentArpPacket: {},
  },
  mutations: {
    setIcmpIndex: function (state, index) {
      state.currentIcmpIndex = index;
    },
    setUdpIndex: function (state, index) {
      state.currentUdpIndex = index;
    },
    setArpIndex: function (state, index) {
      state.currentArpIndex = index;
    },
    setIcmpPacket: function (state, packet) {
      state.currentIcmpPacket = { ...packet };
    },
    setUdpPacket: function (state, packet) {
      state.currentUdpPacket = { ...packet };
    },
    setArpPacket: function (state, packet) {
      state.currentArpPacket = { ...packet };
    },
  },
  actions: {},
  modules: {},
  getters,
});
